Draft
Conversation
This hard codes the expected coinbase `scriptSig` hex. This protects consensus-critical genesis construction against refactors.
This is equivalent to the prior `std::vector<unsigned char>` built from `pszTimestamp` and `strlen`. It preserves the exact byte sequence while avoiding raw pointer casts.
Add util tests for `MakeByteSpan`, `MakeWritableByteSpan`, `MakeUCharSpan`, `UCharCast`, and `SpanPopBack`.
This is equivalent to `std::as_bytes(std::span{...})` on the same input.
This is equivalent to `std::as_writable_bytes(std::span{...})` for the same container.
It removes manual span construction without changing the bytes read.
This is equivalent to the prior `reinterpret_cast<unsigned char*>` usage. It centralizes the cast helper without changing the pointer value.
This is equivalent to the prior explicit span construction and casts. It keeps the same bytes while using the shared helper.
This is equivalent to `span.first(span.size() - 1)` for the same input. It makes the intent explicit without changing behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Standardize byte/span conversions to the project’s helpers to reduce manual casts and make intent clearer.
Reduce repeated boilerplate for spans and bytes without changing behavior.
Add a focused test that locks in the mainnet genesis scriptSig bytes, so the consensus critical genesis construction can be refactored safely.
Replace ad hoc byte/span conversions with MakeByteSpan, MakeWritableByteSpan, MakeUCharSpan, UCharCast, and SpanPopBack.
Switch genesis timestamp bytes to MakeUCharSpan(std::string_view{...}) with no change to output.